package edu.wust;

public class exam45 {
    public static long san(long n){
        return n*(n+1)/2;
    }
    public static boolean wu(double n){
        double p=2.0*n/3.0+1.0/36.0;
        double x=Math.sqrt(p)+1/6.0;
        double end=0.0000000001;
        long xx=(int)Math.floor(x);
        ;;
        if(x-xx<end)
            return true;
        return false;
    }
    public static boolean liu(double n){
        double p=n/2.0+1.0/16.0;
        double x=Math.sqrt(p)+1.0/4.0;
        double end=0.0000000001;
        long xx=(int)Math.floor(x);
        if(x-xx<end)
            return true;
        return false;
    }//1533776805
    public static void main(String[] args) {
        for(long i=286;;i++){
            long temp=san(i);
            if(wu(temp)&&liu(temp)){
                System.out.println(temp);
                break;
            }
        }

    }
}

